package com.example.wx.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.wx.service.CaseAnalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;

@Controller
@RequestMapping("/caseAnal")
@SessionAttributes("caseAnalysis")
public class CaseAnalController {

    @Autowired
    private CaseAnalService caseAnalService;

    @GetMapping("/index")
    public String viewMain(){
        return "index";
    }

    //获取案件全体分布
    @GetMapping("/distribute")
    @ResponseBody
    public Object getDistribute(){

        //连接数据库获取数据
        JSONObject AnalList = caseAnalService.getAnalList();

        return AnalList;
    }

    @GetMapping("/uncheckedList")
    @ResponseBody
    public Object getUncheckedCases(){
        return caseAnalService.getUncheckedList();
    }

    @GetMapping("/completeCase")
    @ResponseBody
    public Object getUncheckedCasesById(String caseId) {
        return caseAnalService.getUnckCaseById(caseId);
    }

    @GetMapping("/viewCommand")
    public String viewCommand(){
        return "unchecked";
    }
}
